package com.sun;

import com.sun.dao.UserDao;
import com.sun.entity.User;
import com.sun.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author SunRui
 * @description 启动项
 * @date 2024/9/10 18:17
 */
public class Open {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

        /*
        3中输出
         */

        UserDao userDao = (UserDao) ctx.getBean("userDao");
        userDao.selectUser((User) ctx.getBean("user"));

        System.out.println("=======================================");

        UserService userService = (UserService) ctx.getBean("userService");
        userService.soutUser();

        System.out.println("=======================================");

        UserService userService1 = (UserService) ctx.getBean("userServiceImpl");
        userService1.soutUser();
    }
}
